import {getLocales} from 'react-native-localize';
import en from '../locale/en';
import zh from '../locale/zh';

export const getLocale = () => {
  const preferredLocales = getLocales();
  return preferredLocales[0].languageTag;
};

const translations = getLocale().startsWith('zh') ? zh : en;

export const t = key => {
  return translations[key];
};
